import {AnnotationType} from "../entity/entity.ts";

export default class AnnotationMgr {

    static getAnnotation(text: string): AnnotationType {
        if (text == AnnotationType.ROUTE) {
            return AnnotationType.ROUTE
        } else if (text == AnnotationType.HL_ROUTE) {
            return AnnotationType.HL_ROUTE
        } else if (text == AnnotationType.SERVICE) {
            return AnnotationType.SERVICE
        } else if (text == AnnotationType.HL_SERVICE) {
            return AnnotationType.HL_SERVICE
        } else if (text == AnnotationType.HL_ATTRIBUTE) {
            return AnnotationType.HL_ATTRIBUTE
        } else if (text == AnnotationType.HL_LIFECYCLE) {
            return AnnotationType.HL_LIFECYCLE
        } else {
            return AnnotationType.UNKNOWN
        }
    }

    static isRouteAnnotation(annotation: AnnotationType) {
        return [AnnotationType.ROUTE, AnnotationType.HL_ROUTE].includes(annotation)
    }


    static isServiceAnnotation(annotation: AnnotationType) {
        return [AnnotationType.SERVICE, AnnotationType.HL_SERVICE].includes(annotation)
    }

    static isAttrAnnotation(annotation: AnnotationType) {
        return [AnnotationType.HL_ATTRIBUTE].includes(annotation)
    }

    static isLifecycleAnnotation(annotation: AnnotationType) {
        return [AnnotationType.HL_LIFECYCLE].includes(annotation)
    }

    static isUnknownAnnotation(annotation: AnnotationType) {
        return [AnnotationType.UNKNOWN].includes(annotation)
    }
}